package com.sig.bean;

import org.nutz.dao.entity.annotation.*;

import java.util.List;

/**
 * @author sig
 * @since 2016-6-21 13:48:45
 */
@Table("user")
public class User extends BasePojo {
    @Id
    private int id;

    @Name
    private String username;

    @Column
    @ColDefine(width = 128)
    private String password;

    @Column
    private String salt;

    @Column
    private boolean locked;

    @ManyMany(from = "u_id", relation = "user_role", target = Role.class, to = "role_id")
    private List<Role> roles;

    @ManyMany(from = "u_id", relation = "user_permission", target = Permission.class, to = "permission_id")
    private List<Permission> permissions;

    @One(target = UserProfile.class, field = "id", key = "userId")
    private UserProfile profile;

    public User() {
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getSalt() {
        return salt;
    }

    public void setSalt(String salt) {
        this.salt = salt;
    }

    public boolean isLocked() {
        return locked;
    }

    public void setLocked(boolean locked) {
        this.locked = locked;
    }

    public List<Role> getRoles() {
        return roles;
    }

    public void setRoles(List<Role> roles) {
        this.roles = roles;
    }

    public List<Permission> getPermissions() {
        return permissions;
    }

    public void setPermissions(List<Permission> permissions) {
        this.permissions = permissions;
    }

    public UserProfile getProfile() {
        return profile;
    }

    public void setProfile(UserProfile profile) {
        this.profile = profile;
    }
}
